{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 第三章　随机抽样\n",
    "\n",
    "\n",
    "作者：[王何宇](http://person.zju.edu.cn/wangheyu)\n",
    "\n",
    "[浙江大学数学科学学院](http://www.math.zju.edu.cn)\n",
    "\n",
    "上一章我们讨论了最简单的随机分布，均匀分布随机数的产生方法。有了这个均\n",
    "匀分布随机数的基础，这一章我们将进一步讨论如何产生各种所需的随机变量和\n",
    "随机过程。首先我们回顾一下概率论的一些基本定义。\n",
    "\n",
    "## 基础知识回顾\n",
    "我们用概率分布来描述一个随机变量服从的分布规律，具体来说，离散型随机变\n",
    "量的概率分布称为"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**概率质量函数（Probability Mass Function, PMF)**\n",
    "若离散型随机变量 $\\xi$ 取值为 $x_1, x_2, \\cdots, x_n$ 的概率分别为 $p_1, p_2, \\cdots, p_n$, 即\n",
    "$$\n",
    "\\begin{equation}\n",
    "    P(\\xi = x_i) = p_i, i = 1, 2, \\cdots, n,\n",
    "    \\label{eq::dis_df}\n",
    "\\end{equation}\n",
    "$$\n",
    "则其概率分布函数\n",
    "$$  \n",
    "\\begin{equation}\n",
    "f(x) = \\left\\{\n",
    "    \\begin{array}{ll}\n",
    "      p_i, & x \\in S,\\\\\n",
    "      0, & x \\in \\mathbb{R}\\setminus S\n",
    "    \\end{array}\\right.\n",
    "    \\label{eq::dis_pmf}\n",
    "  \\end{equation}\n",
    "$$\n",
    "又称为概率质量函数，简称为 PMF。其中 $S = \\{x_1, x_2, \\cdots, x_n\\}$ 称为样本集。显然，在离散的情形下，有\n",
    "$$\n",
    "\\sum_{x_i \\in S}p_i = \\sum_{i = 1}^np_i = 1.\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**累积分布函数（Cumulative Distribution Function, CDF）**\n",
    "称\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    F(x) = P(\\xi \\leq x) = \\sum_{x_i \\leq x}p_i, x \\in \\mathbb{R}\n",
    "    \\label{eq::dis_cdf}\n",
    "  \\end{equation}\n",
    "$$  \n",
    "为累积分布函数，简称为CDF。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**两点分布** 两点分布的 PMF 为\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    f(x) = \\left\\{\\begin{array}{ll}\n",
    "    0.5, &x = 0; \\\\\n",
    "    0.5, &x = 1;\\\\\n",
    "    0, &x \\notin \\{0, 1\\}.\n",
    "    \\end{array}\\right.\n",
    "    \\label{eq::2p_PMF}\n",
    "  \\end{equation}\n",
    "$$  \n",
    "对应的CDF为\n",
    "$$  \n",
    "\\begin{equation}\n",
    "    F(x) = \\left\\{\\begin{array}{ll}\n",
    "    0, & x < 0; \\\\\n",
    "    0.5, &0 \\leq x < 1; \\\\\n",
    "    1, &x = 1.\n",
    "    \\end{array}\\right.\n",
    "    \\label{eq::2p_CDF}\n",
    "  \\end{equation}\n",
    "$$  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "更常见的，离散型随机变量的特征会像下面那样表示。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**二项分布** 的PMF一般写做\n",
    "$$\n",
    "\\begin{equation}\n",
    "  b(k; n, p) = \\binom{n}{k}p^k(1 - p)^{n - k}, 0 < p < 1, k = 0, 1, \\cdots, n.\n",
    "  \\label{eq::binom_PMF}\n",
    "\\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "随机模拟的一个重要步骤是根据需要产生服从各种分布的样本集。之前我们已经讨论过如何产生服从 $U(0, 1)$ 的均匀分布的随机数，那么现在，我们就要从服从 $U(0, 1)$ 的均匀分布的随机序列出发，产生独立同分布的目标随机数序列。这里两个问题的解决是各自独立的。首先随机序列的独立性完全由均匀分布的随机序列的独立性决定，这在上一章已经讨论。我们接下去主要讨论如何确保随机序列同分布，也即和要求的目标分布一致。这里还有一个重要问题是产生效率，因为我们必须在计算机上算法实现。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 直接抽样方法\n",
    "\n",
    "如果随机变量的 PMF 是已知的，那么我们可以从均匀分布的随机数出发，直接根据概率论定义构建抽样算法。这种方法称为直接抽样方法。即产生均匀分布的随机序列，然后通过某种变换或抽取，使得从中变换抽取后的随机数样本集 $X$ 服从 $F(x)$，这里 $F(x)$ 是已知积累分布函数。也即要求 $\\forall \\xi \\sim F$，\n",
    "$$\n",
    "\\begin{equation}\n",
    "  P(\\xi \\leq x) = F(x), x \\in \\mathbb{R}.\n",
    "  \\label{eq::def_cdf}\n",
    "\\end{equation}\n",
    "$$\n",
    "这里，一方面，我们要从算法保证（证明）$X$ 确实服从指定分布 $F(x)$；另一方面，对于一个实际的产生的抽样结果，也要能通过指定的统计检验。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 逆变换算法\n",
    "\n",
    "1947 年，曼哈顿计划的参与者 Stanislaw Marein Ulam 提出了逆变换算法，注意到随机变量 $\\xi$ 的累积分布函数 $F(x): \\mathbb{R} \\mapsto [0, 1]$ 是非降的，故定义其逆函数为\n",
    "$$\n",
    "\\begin{equation}\n",
    "  F^{-1}: [0, 1] \\mapsto \\mathbb{R}, F^{-1}(y) = \\inf \\{x \\left| F(x).\n",
    "  \\geq y \\right.\\}\n",
    "  \\label{eq::inv_cdf}\n",
    "\\end{equation}\n",
    "$$\n",
    "\n",
    "**证明：** $\\forall x \\in \\mathbb{R}$，\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    P(\\xi \\leq x) = P(F^{-1}(\\eta) \\leq x) = P(\\eta \\leq F(x)) = F(x).\n",
    "    \\label{eq::prof_inv_cdf}\n",
    "  \\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "所以我们算法的设计思路就是对一个均匀分布的随机数序列 $U$，求其逆变换 $X = F^{-1}(U)$，则 $X$ 的分布服从 $F(x)$。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 列表查找法\n",
    "\n",
    "这种做法一般针对离散分布，特别是能给出分布表的离散分布。若离散分布的 PMF 表为\n",
    "$$\n",
    "\\begin{array}{cccc}\n",
    "  x_0 & x_1 & \\cdots & x_n \\\\\n",
    "  p_0 & p_1 & \\cdots & p_n,\n",
    "\\end{array}\n",
    "$$\n",
    "且 $x_0 < x_1 < \\cdots < x_n$, 则我们不难构建CDF表\n",
    "$$\n",
    "\\begin{array}{cccccc}\n",
    "  x_0 & x_1 & \\cdots & x_k & \\cdots & x_n \\\\\n",
    "  F_0 = p_0 & F_1 = p_0 +  p_1 & \\cdots\n",
    "  & F_k = \\sum_{i = 0}^k p_i & \\cdots & F_n \\equiv 1.\n",
    "\\end{array}\n",
    "$$\n",
    "根据 PMF 定义，$\\forall x \\notin \\{x_0, x_1, \\cdots, x_n\\}$，有$f(x) = 0$，故我们可以认为 $F_{-1} = 0$。\n",
    "现在对$\\eta \\sim U(0, 1)$, 必有$0 \\leq k \\leq n$（为什么？）, 满足\n",
    "$$\n",
    "\\begin{equation}\n",
    "  \\label{eq::def_dis_pmf}\n",
    "F_{k - 1} < \\eta \\leq F_k,\n",
    "\\end{equation}\n",
    "$$\n",
    "则可取 $\\xi = x_k$。从PMF角度，就是\n",
    "$$\n",
    "\\begin{equation}\n",
    "  \\xi = \\min\\left\\{x_k\\left|\\eta \\leq \\sum_{i = 0}^kf(x_i)\\right.\\right\\}, \\eta \\sim U(0, 1).\n",
    "  \\label{eq::dis_inv}\n",
    "\\end{equation}\n",
    "$$\n",
    "在具体的抽取算法中，这一过程就是查表。对于较长的表，可以采用二分查找。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from __future__ import print_function, division\n",
    "\n",
    "# 这句话是非标准的python，用于ipthon或jupyter这样的系统中，表示绘图即刻自动展开。\n",
    "%matplotlib inline\n",
    "\n",
    "# 这里把全部Warning过滤掉了. \n",
    "# 参见https://docs.python.org/2/library/warnings.html\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "from scipy.special import comb, perm\n",
    "from scipy import stats\n",
    "import numpy as np\n",
    "import sys\n",
    "import matplotlib.pyplot as plt\n",
    "np.random.seed(250)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 离散分布举例\n",
    "下面产生一个服从$n，p$的二项分布。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = 10\n",
    "p = 0.3\n",
    "k = np.arange(0, n + 1, 1)\n",
    "# 生成器，在具体调用时产生序列。\n",
    "PMF = [stats.binom.pmf(i, n, p) for i in k] "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.028247524900000005, 0.12106082100000018, 0.2334744405, 0.26682793200000016, 0.20012094900000013, 0.10291934520000007, 0.03675690899999999, 0.009001692000000002, 0.0014467004999999982, 0.00013778100000000015, 5.904899999999995e-06]\n"
     ]
    }
   ],
   "source": [
    "print(PMF) # 表格中数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "接下去绘制PMF和CDF的插图。这里也可以学习一下Python如何绘图。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEQCAYAAABfiGi4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAa50lEQVR4nO3df5xddX3n8dc7QWIGSRyBLkuXzAgsjzTu+mDd0UKLRH4UCK6GRmhcx8cWqjulj4fLLlCsEMUY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qMbY5+tncoMMyq6rd7mg2m6jnSW83g3Qn/PXAA9kD+ABeBt4qqSciBkcrSXon0J0tH2ub5WVmTeNQMCvmlxHxWPb3Y5KGgIc5+BiCF4Efk95lMFhW74PAD0jvNhhrm2Yzgi8fmU3M9mzaXVa2Afid0ZfaZNPfycrNZgWHgtnEdGfTfyor20h6KNvp2fy7gWMY47n+kg6r+LTkW9Js9nAomBVU9sV9Munps/8C5B3DEbEP+B7pkhHZ9HsRUauf4CjglYrP2dPTerNi3KdgVszoF/ioIWBlRPxjxY/7DcAtkq4ELiI9zrqW54FzKsqenIK2mk2YQ8GsmNEv8CBdMtob1R8x/B3S49jXAkcAd4+xzV+Wj1QymwkcCmbFFPoCj4gXJd0DXAF8MyJenP6mmU0dh4LZ1PsyMI/0ZjCzWcWhYDbFImILFa8ENZstPPrIzMxyfh2nmZnlfKZgZmY5h4KZmeUcCmZmlnMomJlZzqFgZmY5h4KZmeUcCmZmlnMomJlZ7v8DkRnvPcdgDLAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "for i in k:\n",
    "    plt.plot([k[i], k[i]],[0,PMF[i]],'b-') # 画n + 1条直线。\n",
    "    plt.plot(k[i], PMF[i],'bo') # 顶部画个点。\n",
    "plt.xticks(fontsize=15) # 调整一下标记字体。\n",
    "plt.yticks(fontsize=15)\n",
    "plt.xlabel(r'PMF',fontsize=15) # 加标题。\n",
    "plt.savefig('PMF_bin.pdf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将PMF累加即得离散分布的CDF，也即\n",
    "$$\n",
    "F(x_k) = \\sum_{-\\infty}^k f(x_i).\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEQCAYAAACz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8r/vzRJa+6fEKVjRwOfMuzfUjPxn1yiJ/zFGl49OUln72t5HXiEOsxGxKP4ZvBUO8gWK7n/hwwo6RswxDrMRsSB77l2R+ALcDkIX7Oq0k9+D8WlW2PiPYhfq5ZVXlIx3IrIrYBdwEzh/hRJwFrC59nttty4FveXQW0SDqvdIWkUZJK59KXbjMXeBPw1WyaZ1Y9HtKxXIuIFZIWk+bSv4X0NKku0sOizyc9Vq93Fs8USW8mXXj1GuB04H1AW0RcP9xtNxsoP/HKjHRrBeCjpIdn9z4s+xbgXyPid5KK/6NsATYBPwe+HhErSj7rUuCjEVH84HGzmnPgm5nlhMfwzcxywoFvZpYTDnwzs5xw4JuZ5YQD38wsJxz4ZmY54cA3M8sJB76ZWU78f0TjyGo4BGZqAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = plt.figure()\n",
    "c = 0\n",
    "CDF = [0]*(n + 1)\n",
    "for i in range(n):\n",
    "    c += PMF[i]\n",
    "    CDF[i] = c\n",
    "    plt.plot([k[i], k[i + 1]],[c, c],'b-') \n",
    "    # ''表示无颜色，但又给了edgecolors，就是为了画个空圈。s是大小。\n",
    "    plt.scatter(k[i + 1], c, color='', marker='o', edgecolors='b', s=40)\n",
    "    plt.scatter(k[i], c, color='b',marker='o', s=40)\n",
    "plt.scatter(0, 0, color='',marker='o', edgecolors='b', s=40)\n",
    "plt.scatter(n, 1, color='b',marker='o', s=40)\n",
    "plt.xticks(fontsize=15)\n",
    "plt.yticks(fontsize=15)\n",
    "plt.xlabel(r'CDF',fontsize=15)\n",
    "plt.savefig('CDF_bin.pdf')\n",
    "CDF[n] = 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "构建一个用于二分法查表的函数。稍微有一些针对性处理。关于二分查找和递归过程的内容可参考MIT的网络公开课《算法导论》，03年版。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def bisection_search(F, eta, start, end):\n",
    "    if (eta <= F[start]):\n",
    "        return start\n",
    "    n = end - start\n",
    "    if (n <= 0):\n",
    "        sys.exit()\n",
    "    k = (start + end) // 2\n",
    "    if (eta > F[k]):\n",
    "        if (eta <= F[k + 1]):\n",
    "            return k + 1\n",
    "        else:\n",
    "            return bisection_search(F, eta, k + 1, end)\n",
    "    else:\n",
    "        return bisection_search(F, eta, start, k)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "做1000000次随机抽取，形成二项分布的随机序列X。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "U = np.random.rand(1000000)\n",
    "X = [bisection_search(CDF, U[i], 0, n) for i in range(1000000)]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "用统计来验证我们生成的随机序列确实服从目标分布。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEGCAYAAABrQF4qAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAA3PElEQVR4nO3dd3hUZdrH8e89MylAkBoLBAEFKQkIEhB1pUURFekoAgpiWduybtHXtor6uouru9Z9F1ERVunBwiplERErQsBACEVahABi6D3JzDzvH+ckG0Igk2SSMzO5P9c1V2bOPOec3wnhnjOnPI8YY1BKKRW5XE4HUEopVbm00CulVITTQq+UUhFOC71SSkU4LfRKKRXhPE4HKK5hw4amWbNmTsdQSqmwsnLlyr3GmPiS3gu5Qt+sWTPS0tKcjqGUUmFFRH4603t66EYppSKcFnqllIpwWuiVUirChdwxeqWqm/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UlISK1asKHW7Qpnu0auS7dsC026Gg9th0FvQ/uYSm+0knn96+/G7qDm877uGZf7T96pUGZRxzzuYCgo2WHv0d955Z+F77du3Jysri+nTp3PDDTecMl/BoZtA5Ofns3fvXh5//HEAOnTowN69ewHYu3cvdevWrfB2lJfb7SY9PZ2DBw8ycOBA1q5dS1JSEm63m+joaI4cOULt2rUdy1cRWujV6X76FmYMBwRunwtNrzhr8wm+mxjqWcrTnin0zfszPtxVk1MFVWkFu1+/fvzxj3/kiy++YN++feVax4YNG2jRogXR0dEArFq1iksvvbRw/YHc8dm4cWN27NhR+Do7O/uUcwblbVugbt269OzZkwULFhSeBM7NzSU2Nvas84UyPXSjTrV6BkzpBzUbwt2LSy3yALlE81z+SNq4djDC/VkVhFROGDNmDE8//fQph3TOJiUl5bTDJOnp6Wzbto3c3FyOHj3KM888w0MPPQRAvXr18Pl8pRb7zp07s2nTJrZt20ZeXh4zZsygX79+Ja7zbG2LysnJ4eDBg4D1zWbRokW0bt0agH379tGwYcMydSIWarTQK4vfD5//L3z4a6u437UI6l8U8OwL/Z35ypfEHzyzqc/hSgyqnJKQkMDYsWMDauv3+9m8eTP169c/Zfrq1asZNGgQV155JV26dGHs2LF07dq18P3evXvz9ddfF76+9dZbueKKK9i4cSMJCQm88847eDwe3njjDa677jratGnDzTffTGJiYonrPFPbAjfccAO7du1i9+7d9OzZk/bt29O5c2euvfbawstHlyxZwo03hve9G2JC7M7G5ORko0MJVrH8E/DRfZD5IXS8Dfq+DO7S916aPXrqZZUtJJv50Y8x29edx713VVbaiLthav369bRp08bpGEG1du1aJk2axN///vcyzbdq1Spefvll3nvvvSpbZ2kGDRrE+PHjueSSS4K63Ioo6W9GRFYaY0q8ezGgPXoR6SMiG0Vks4g8WsL7vxeRdSKyRkQWi0jTIu/5RCTdfswt4/aoynb0F5jcFzI/gmufhX6vB1TkS7LZJDDF15th7iUkydbg5lRhJSkpqVwF97LLLqNnz56FN0xVxTrPJi8vjwEDBoRUkS+PUgu9iLi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TQq+UUhFOC71SSkU4LfRKKRXhtNArpVSE+39KAYcq9qGyFAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.hist(X, normed=True, label=\"Stat. of the Sampling\");\n",
    "plt.plot(PMF, label=r\"PMF, $b(10, 0.3)$\")\n",
    "plt.legend()\n",
    "plt.xlabel(r\"Statistical Test of the Samples\")\n",
    "plt.savefig('test_bin.pdf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "实测结果和理论符合的很好。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 连续分布的情形\n",
    "而对于连续型随机变量，可以看作是离散型随机变量的一种极限情形。此时概率分布无法逐点定义，而是定义在样本集内的正测度集上，即考察随机变量落在一个正测度集内的概率是多少。而从这个角度我们发现，之前在定义所引入的累积分布函数\n",
    "$$\n",
    "F(x) = P(\\xi \\leq x), x \\in \\mathbb{R}\n",
    "$$\n",
    "对连续型随机变量仍然适用，而在此基础上，可进一步引入直观上“概率如何在一点上的定义”。由于一点是零测度集，所以这种定义无法脱离正测度集的概\n",
    "念独立存在，而被看作“微元正测度集”的概率。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**概率密度函数（Probability Density Function, PDF）** 对连续型随机变量，$\\forall x \\in \\mathbb{R}$, 我们仍称\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    F(x) = P(\\xi \\leq x), x \\in \\mathbb{R}\n",
    "    \\label{eq::df}\n",
    "  \\end{equation}\n",
    "$$  \n",
    "为累计分布函数，若存在某个非负的可积函数 $f(x)$，满足\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    F(x) = \\int_{-\\infty}^x f(y) dy, \\forall x \\in \\mathbb{R},\n",
    "    \\label{eq::pdf}\n",
    "  \\end{equation}\n",
    "$$  \n",
    "则称 $f(x)$ 为对应随机分布的概率密度函数，简称为PDF。此时，\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    f(x) = F'(x).\n",
    "    \\label{eq::pdf2cdf}\n",
    "  \\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "注意到我们之前定义的针对离散型随机变量的 PMF，事实上和这里定义的 PDF 并无冲突，甚至可以看作是 PDF 的一个特例（这里要看你如何定义积分了）。关于逆变换的定义也可以完全沿用。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对于连续分布的采样抽取，如果存在容易计算的逆变换解析表达式 $F^{-1}(y)$，那么对于 $U(0, 1)$ 的均匀分布的随机变量 $\\eta$，直接计算 $F^{-1}(\\eta)$ 即可。也就是说，\n",
    "$$\n",
    "\\begin{equation}\n",
    "  \\xi = \\min\\left\\{x \\left|\\eta \\leq \\int_{-\\infty}^x f(t)\n",
    "  dt\\right.\\right\\} = F^{-1}(\\eta), \\eta \\sim U(0, 1),\n",
    "  \\label{eq::inv}\n",
    "\\end{equation}\n",
    "$$\n",
    "则 $\\xi \\sim f(x)$。下面算法给出了Rayleigh分布逆变换抽样的实现。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 连续分布举例\n",
    "下面是连续情形的逆变换直接抽样。如果能写出逆变换的解析形式，而且便于计算，那么整个过程非常直接方便。这是一个Rayleigh分布直接抽样的例子。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sample_Rayleigh(U, sigma):\n",
    "    return np.sqrt(-2 * sigma**2 * np.log(U))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "还是直接抽样1000000次。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "U = np.random.rand(1000000)\n",
    "X = sample_Rayleigh(U, 0.5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "同样的，我们需要统计验证。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEGCAYAAAB1iW6ZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAA4kklEQVR4nO3deXxU1fn48c+ThSWAICRQWQQsOwEDAqIIoihiq6i47xSVaqt2+9r6rXypVfurVbRK1VpcitYFVFyoIirUDQqyRvZ9kYBACGsSQsjM8/vj3gmTZZJJMsmdmTzv1yuvzNw5c+5zZ+48c+bce88RVcUYY0zsS/A6AGOMMZFhCd0YY+KEJXRjjIkTltCNMSZOWEI3xpg4keTVilNTU7VTp05erd4YY2LS0qVL96lqWnmPeZbQO3XqxJIlS7xavTHGxCQR2R7qMetyMcaYOGEJ3Rhj4oQldGOMiROe9aGb2Hb8+HGysrIoKCjwOhRj4lKjRo1o3749ycnJYT/HErqplqysLJo1a0anTp0QEa/DMSauqCo5OTlkZWXRuXPnsJ9nXS6mWgoKCmjVqpUlc2NqgYjQqlWrKv8CtoRuqs2SuTG1pzqfL0voxhgTJyyhh5KbDcePeh2FMcaErdKELiIvi8heEVkV4vEbRWSFiKwUkf+KyOmRD7MO5eUw7//OhkldOPrIqfDfZ7yOyBhjwhJOC30qMKqCx7cC56pqH+BhYEoE4vKG7zi8fhUDEjbw5PGrmOdPh08fgIXPex2ZCSExMZGMjAzS09O5+uqryc/PL7G8d+/enH766TzxxBP4/f4SjwX+tm3bFvb6Jk+eTM+ePbnxxhsrjOXSSy/l4MGD1d6upk2bVlrm7LPPrvDxbdu2kZ6eHtb6Knq9KlrPwYMHee6558KKsyrxVFR/ZdvttdmzZ9O9e3e6dOnCo48+Wm6ZTp060adPHzIyMhgwYEDkVq6qlf4BnYBVYZQ7G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keCWQAaw3b19BOfnMzg/s/OAQ+L0YV8c9JzgcsF1twXyVfU14HFODFtZbnmcD8bVbtLA/cCA0yIMDNl7a9gbd8InwLjAt7qItBOR1tWIbz3QSUS6uPdvxvm2D4uq5gP3Ar9xd+7g7RpbqviLOEl/saoeKKe6T3EGHcLdpoxyyizE+bkJTsunSkTkx3LiU9MVJwkcrCTucAX6Mc8BDpXz66jc7RORH6rqSlX9C85IoD3KqftUOTFv5A0409rhtsJ2ARNwknu1uL9qFwNPAx+6LbzDwFYRudqNU6TUcY+gbSlvG8rdR6sRXnPge7cVfjNOd0JI7vqaqzOw269wvghKWwScK85xsUTgeqqw31fBE8Dvgn6ZB4Ta10N9Tkv7GrhWnIlU0nBa5ouAr4KWnwKcV52go62F3hT4m/sztAinDzQwO8kUYLaI7FLV80RkOU4/5A6cn42UVy5oeR/gcRHxA8eBuyoqr6qrReRPwJci4sP5+TkWp0X+togcwEn6nauygar6qYj0BBa4+SkXuAnoUsX4CkTkJ24sSTgfxuerGMtyEVmB86F4DGekwQnAR6XKLRWRw4ROPPcCz7p1JeHsnHeWKvNL4DUReQDnJ21lXUql3Qz8VUTycfaNG1XVJyIh466CAnd/CnQrlRZq+34pIufhtP5WU363yXqcCRlexhkq9e9Bj72O04++tppxB0zH6dIYHrTsRpxfMxNwtmsa8G05zy2zDap6LMQ+ureKcT0HzBCRW3De87xKyjcDPhCRRjgt2l+XLqCq34tzKuznbpmPVPWDKsZVKXVGcS3v7JZQ+8K/gXdE5DKCEn453sPpYvsW59fab1V1tzgHxc/H2Ue+wzmuUGU22qKplPvr4Qugh9vaqk4dKTjdPSoi1+EcIL0sgmFWi4h8gXMwq85nkhfnDKDlGpvDJpsoFG0tdBNl3NbVn4BfVzeZu87AOZgkOF0l5bWE6w23jzYPp5/WmIiwFroxxsSJqDooaowxpvosoRtjTJywhG6MMXHCEroxxsQJS+jGGBMn/j8drlMMsiy9wwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "s = 0.5\n",
    "x = np.linspace(0,6,10000)\n",
    "f = (x/s**2) * np.exp(-x**2/(2 * s**2))\n",
    "plt.hist(X, bins=50, normed=True, label=\"Stat. of the Sampling\");\n",
    "plt.plot(x, f, label=r\"PDF of Rayleigh Distribution, $\\sigma = 0.5$\")\n",
    "plt.legend()\n",
    "plt.xlabel(r\"Statistical Test of Rayleigh Samples by Inverse Transform Method\")\n",
    "plt.savefig('Ray_inv.pdf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "这里hist的参数bins=50代表了做统计的区间分段数，由于我们的样本数足够，这个数字越大，统计图会越连续。下面是指数分布："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sample_Exponential(U, beta):\n",
    "    return -beta * np.log(U)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0.5, 0, 'Statistical Test of Exponential Samples by Inverse Transform Method')"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEGCAYAAACevtWaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAzI0lEQVR4nO3deXwU9f348dc7BwQIIiQBhaABuQkQlMOKIIpaUIsHWjxQKd7317ZY2vJDPPr94lerFvEoXth6gEe1fAWhHkCVghAQwqHIFSWAEsJluEKy798fMwmbZDe7STaZZPN+Ph55ZHf2MzPvmZ1572c+M/MZUVWMMcZElxivAzDGGBN5ltyNMSYKWXI3xpgoZMndGGOikCV3Y4yJQnFezTg5OVnT0tK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OGFHD58GIDXX3+dAQMGkJGRwW233UZRUVGF5SdMmMDmzZvJyMhg/PjxpWrll112GWeccQY9e/asdA000LounvbBgwe5+OKL6dOnD+np6cyaNatcHNnZ2XTt2pUbbriB9PR0tm3bViq2wsLCcuusbI3+iSeeYPLkyeWm7R9LVdZxRWbPns3YsWM5duwY06ZNY9SoUZVab/6GDBlCq1atgn6+bNkyOnXqRMeOHWnUqBFXX301//znP6s8v2BC3sQkIm8BQ4FkEckBHgTiAVT1BWAucBGwCTgE/CriUfprmgQxcfBTzf1+NDgfTYAf1kR2mif1ghHhH24WFhby0UcfMXx44AuzOnbsSFFREbt27eLw4cNkZGQA0KFDB95///1SZVesWMGrr77Kl19+iaoycOBAzjnnHF544QXmzZvHggULSE5OLjcP/+kC/P73v2f06NGMHDmSiRMncvjwYcaMGUN6ejrZ2dls2LCBl19+mUGDBjFu3Diee+45fvvb3wadf8uWLdm4cSNvvfUWL774Ir/85S957733OOOMM5g1axaLFy8mPj6eO++8kzfeeIMhQ4YELD9mzBimTJnC2rVrWbVqFQDPP3/8IrVXXnmFVq1acfjwYfr378+oUaNISkoK+7vwX9dt2rQpGT5v3jzatm3LnDlzANi/fz8DBw4sFUd2djYbN27ktdde48wzzyw37UDr7MorrwwYR9ll9FfZdTxmzJgKl3nFihX079+fpKQk0tLSyv34Dx48mJ9++qnceE888QTnn39+hdMua/v27bRv377kfWpqKl9++WWlphGOkMldVa8J8bkCd0UsolBiYpzau51QjQr+CXXw4MHcdNNNIcdp0qRJwB2+2BdffMHll19Os2bNALjiiiv4/PPP6du3b5WmO2nSJPr3709CQgJTp04tGd6+fXsGDRoEwJgxY5g6dSq//e1vg85/5MiRdOjQoWR5zzjjDLKzs9m3b19JcileJ61bt2bIkCEBy4cyderUkh+8bdu2sXHjxkol92B69erFb37zG373u99xySWXMHjwYPbu3Vuu3KmnnhowsUPgdRYsuVeksuu4Ij6fj5ycHMaOHcvo0aO57bbbePLJJ5k4cWJJmc8//7zSMXqtfnY/0LwN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L81CMeHd4DE6NF/ezL9wa0V5x29PDnPd84I7i6YpIFwn9wI1gy94C2Osm9m44Nc2gRKStu9MXy+D4dtUc2OnGdV2IeAIpt37KfL4BSBH3ma9uW2xP98e0vaouwGn2aIHTLFnWBW47axOcJygtdoe/j3M00h9n3VbVIpxt7RacRA/O0dCg4m1LnLbsLmVHrGAZ5uO0F4tbrm8VY6vUvlbBPuTvc2C0OOeAUnB+mJZVMb6KTMDpC95fwG3B/SzYtl7W57jbqfuDt1ud50L8G2f7Q0RG4FTQKlTbNfdE4BlxLncrBDbhNNGA0049T0R2qOq5IvIV8A1Ou/Niv2mUKuc3vBfwuIj4gGM4j6gKWl5V14nIn4BFIlKE04wyFqf28I6I7MX5AehQmQVU1X+JSHdgibvt5+O0c3aqZHxHRORXbixxON0dh9OjXhP3kLDYPJxa7M3AALfm9m+cQ8YHcX5EB4jIRJzD39HueDcCL4hzAnIL8KsQ830Jt63Y3elzCf24t2Df5TzgdhH5GmeHWRpiOvHAE+7Of8Sd9+3uZ/8Pp5ko1/0fzg7mL9j6AZxHAopzwmyq25wVh/PUq2+B191hAkzVwI8OXIbzDIBU4HVVzfSb7gJgn3u0WyWqWiTOSdSxuAlUVXPdo5i3RKSxW3SiG7O/2EDLICKPuMuY5f4AbMVpg66syVRuXwu2j/t7H+eqvNU4R0EPqOoPbiUhYlS13BOlKtgW1uEcQb4gIofd+IKZDLwiTu+ohzj+o/cQzve1DqddP+TzXq1XyAZORPJVNVCN0uDd+nGT5krgKlXdWNvzN/Wf3aFqTB0jIj1wjmo/tcRuqspq7sYYE4Ws5m6MMVHIkrsxxkQhS+7GGBOFLLkbY0wUsuRujDFR6P8DKDPgAc1dOzMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "U = np.random.rand(1000000)\n",
    "beta = 1.0\n",
    "X = sample_Exponential(U, beta)\n",
    "x = np.linspace(0,6,10000)\n",
    "f = 1/beta * np.exp(-x/beta)\n",
    "plt.hist(X, bins=50,normed=True, label=\"Stat. of the Sampling\");\n",
    "plt.plot(x, f, label=r\"PDF of Exponential Distribution, $\\beta = 1.0$\")\n",
    "plt.legend()\n",
    "plt.xlabel(r\"Statistical Test of Exponential Samples by Inverse Transform Method\")\n",
    "#plt.savefig('Exp_inv.pdf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "这种方法是最直接的采样手段。Fishman1995 中给出了一些常见分布的 PDF 以及相应的逆变换表达式。从表上我们就发现并不是每一个能写出表达式的逆变换在计算上都是高效率的，而有的甚至根本没有解析形式。比如最重要的正态分布我们就没有解析的逆变换形式。不过 Hastings1955（这是一本神奇的书，给出了各种难以计算公式的有理逼近估计）给出了一个有理逼近形式：\n",
    "\n",
    "$$\n",
    "\\begin{equation}\n",
    "  F^{-1}(y) = \\mu\n",
    "  + \\mathrm{sign}(y - \\frac{1}{2})\\sigma\\left(t\n",
    "  - \\frac{c_0 + c_1 t + c_2 t^2}{1 + d_1 t + d_2 t^2 + d_3 t^3}\\right),\n",
    "  \\label{eq::approx_normal}\n",
    "\\end{equation}\n",
    "$$\n",
    "\n",
    "其中\n",
    "\n",
    "$$\n",
    "t = \\sqrt{-\\ln\\left[\\min(y, 1 - y)\\right]^2},\n",
    "$$\n",
    "\n",
    "各参数值为\n",
    "\n",
    "$$\n",
    "\\begin{array}{c}\n",
    "  c_0 = 2.515517, c_1 = 0.802853, c_2 = 0.010328,\\\\\n",
    "  d_1 = 1.432788, d_2 = 0.189269, d_3 = 0.001308.\n",
    "\\end{array}\n",
    "$$\n",
    "\n",
    "此公式绝对误差小于$0.45 \\times 10^-3$。\n",
    "\n",
    "如果逆变换本身没有解析形式或者难以计算，那么另一个方法是直接从 CDF 入手计算（注意不是 PDF），当然前提是 PDF 和 CDF 可以快速计算。这本质上就是之前离散的情况的查表的极限沿拓，到了连续情形就变成对一个 $\\forall y \\in [0, 1]$，寻找 $x \\in \\mathbb{R}$，满足\n",
    "$$\n",
    "\\begin{equation}\n",
    "  F(x) = y \\Rightarrow F(x) - y = 0.\n",
    "  \\label{eq::inv_equation}\n",
    "\\end{equation}\n",
    "$$\n",
    "而上述方程，我们可以用数值方法，比如二分法，或 Newton 法求解。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 接受－拒绝方法（Accept-Rejection Method）\n",
    "\n",
    "总是有一些分布，或者写不出反函数的解析表达，或者该解析表达难以计算（或计算量很大）。比如最重要的正态分布就没有显式的积累分布函数的解析表达。而一些初等函数，如指数，对数的计算，事实上计算量是极大的。1947年，冯·诺伊曼从条件概率入手，提出了取舍算法(Accept-Rejection\n",
    "Method，简称AR法)。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Neumann 1951**\n",
    "\n",
    "令$f(z)$，$a \\leq z \\leq b$是某分布的概率密度函数且具有分解形式\n",
    "$$\n",
    "\\begin{equation}\n",
    "    f(z) = c g(z) h(z),\n",
    "    \\label{eq::AR_frac_pdf}\n",
    "  \\end{equation}\n",
    "$$\n",
    "其中\n",
    "$$\n",
    "\\begin{equation}\n",
    "    h(z) \\geq 0, \\int_a^b h(z) dz = 1, c = \\sup_{z}\\left[\\frac{f(z)}{h(z)}\\right],\n",
    "    \\label{eq::AR_pfd_hc}\n",
    "  \\end{equation}\n",
    "$$\n",
    "并且\n",
    "$$\n",
    "\\begin{equation}\n",
    "    0 \\leq g(z) \\leq 1.\n",
    "    \\label{eq::AR_pdf_g}\n",
    "  \\end{equation}\n",
    "$$\n",
    "令 $Z$ 是 PDF 为 $h(z)$ 的随机变量，$U$ 为服从 $U(0, 1)$ 的随机变量。则满足 $U \\leq g(Z)$ 的随机变量 $Z$ 服从PDF为 $f(z)$ 的概率分布。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**证明：** 随机变量 $U$ 的 PDF 为 $1$，$u \\in [0, 1]$；而 $Z$ 的 PDF 为 $h(z)$，$z \\in [a, b]$，故二者联合分布，即随机向量$(U, Z)$ 的 PDF 为\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    f_{U, Z}(u, z) = h(z).\n",
    "  \\end{equation}\n",
    "$$\n",
    "（不严格地，可看作任取 $[0, 1] \\times [a, b]$ 中的一点，事件恰好落在这一点的概率。把点想像成一个点微元。）现在考虑 $Z$ 的条件概率分布\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    h_Z(z\\left|U \\leq g(Z)\\right.) =\n",
    "    \\frac{\\int_0^{g(z)}f_{U, Z}(u, z)du}{P(U \\leq g(Z))}.\n",
    "    \\label{eq::AR_cond_h}\n",
    "  \\end{equation}\n",
    "$$\n",
    "（这个事件说的是，首先 $Z$ 是一个随机变量，它按 $h(Z)$ 的概率分布发生。然后 $U$ 是一个 $U(0, 1)$ 分布的随机变量。两件事情同时发生的概率，可以认为是先有 $h(Z)$ 的概率 $Z$ 落在了 $z$ 点，我们还是把它想像成一个微元事件，同时 $U$ 落在 $[0, g(z)]$ 区间上，可以是其中任何一点，所以要积分。这两件事情的全概率是上式的分子。现在我们求的条件概率是，如果 $U$ 和 $Z$ 各自都是独立的，$U$ 在投点的时候并不知道 $Z$ 在哪里，以及 $g(Z)$ 是多少，但我们还是想问这种情况下，$U \\leq g(Z)$ 的这个事件，关于 $Z$ 的概率密度分布是多少？那么这个就是条件概率分布，它要除以 $U \\leq g(Z)$ 的概率。）\n",
    "  \n",
    "再由（因为 $f(z)$ 是 PDF）\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    c = \\frac{1}{\\int_{a}^b g(z) h(z)dz},\n",
    "    \\label{eq::AR_dri_c}\n",
    "  \\end{equation}\n",
    "$$\n",
    "以及\n",
    "$$\n",
    "\\begin{equation}\n",
    "    \\int_0^{g(z)}f_{U, Z}(u, z)dx = \\int_0^{g(z)} h(z) du = g(z) h(z),\n",
    "    \\label{eq::AR_cond_f}\n",
    "  \\end{equation}\n",
    "$$\n",
    "和\n",
    "$$\n",
    "\\begin{equation}\n",
    "    P(U \\leq g(Z)) = \\int_{a}^b h (z) g(z) dz = \\frac{1}{c},\n",
    "    \\label{eq::AR_conf_f_bottom}\n",
    "  \\end{equation}\n",
    "$$\n",
    "（$Z$ 落在 $z \\in [a, b]$ 点的概率是 $h(z)$，然后此时 $U < g(Z)$ 的概率就是 $g(z)$，故 $Z$ 落在 $z$ 点，同时 $U < g(Z)$ 的单点微元概率是 $h(z)g(z)$，对 $Z$ 取遍全部可能性积分，就得到全部可能的概率。注意和上面分子的不同。分子求的是一个边际分布，是一个关于 $Z$ 的概率密度分布，而分母是一个概率，是一个数。在条件概率公式下，构成了所求的条件概率密度分布函数。）\n",
    "\n",
    "最终有\n",
    "$$\n",
    "\\begin{equation}\n",
    "    h_Z(z\\left|U \\leq g(Z)\\right.) = c g(z) h(z) = f(z).\n",
    "    \\label{eq::dri_f}\n",
    "  \\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "根据定理结果，如果我们已知 $g(z)$ 和 $h(z)$，则可以构建算法产生服从分布\n",
    "$f(z)$ 的随机变量。基本步骤为：\n",
    "1. 产生服从分布 $h(z)$ 的随机变量 $Z$；\n",
    "2. 产生服从 $U(0, 1)$ 的随机变量 $U$；\n",
    "3. 计算 $g(Z)$；\n",
    "4. 若 $U \\leq g(Z)$，返回 $Z$，否则放弃，返回第1步."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**标准半正态分布（half-normal distribution）** 的PDF为：\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    f(z) = \\sqrt{\\frac{2}{\\pi}} e^{\\frac{-z^2}{2}}, 0 \\leq z < \\infty.\n",
    "    \\label{eq::def_half_normal}\n",
    "  \\end{equation}\n",
    "$$\n",
    "我们可以将其写作\n",
    "$$\n",
    "\\begin{equation}\n",
    "    f(z) = \\sqrt{\\frac{2e}{\\pi}} e^{\\frac{-(z - 1)^2}{2}}e^{-z},\n",
    "    \\label{eq::frac_half_normal}\n",
    "  \\end{equation}\n",
    "$$\n",
    "并令\n",
    "$$\n",
    "\\begin{equation}\n",
    "\\begin{array}{rcl}\n",
    "    h(z) &=& e^{-z}, \\\\\n",
    "    g(x) &=& e^{\\frac{-(z - 1)^2}{2}},\n",
    "\\end{array}\n",
    "  \\end{equation}\n",
    "$$\n",
    "以及\n",
    "$$\n",
    "\\begin{equation}\n",
    "    c = \\sqrt{\\frac{2e}{\\pi}} \\approx 1.3155.\n",
    "    \\label{eq::half_normal_c}\n",
    "  \\end{equation}\n",
    "$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面是用AR方法抽取标准半正态分布的过程。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sample_half_normal(N):\n",
    "# N, 实际采样数\n",
    "    U = np.random.rand(N)  # 产生均匀分布\n",
    "    X = -np.log(U)  # 产生服从h的随机变量X, 实际上是beta(1)\n",
    "    G = np.exp(-(X-1)**2/2)   # 计算g(X)\n",
    "    U = np.random.rand(N)  # 再次产生均匀分布\n",
    "    res = X[U<G]\n",
    "    return len(res), res"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "实际产生100万个服从标准半正态分布的随机数。然后做统计检测并和PDF对比。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEGCAYAAAB1iW6ZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAsTklEQVR4nO3de5yUdfn/8dd7Z4HlJBKspYAuBhooxmFFzVBUVMwEf3kCLaUsssRj3wrTTCnLjppGKh5REcRDRYLiCRQLk0UQA0QQKRYNVlQO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4FlDdh+e+D98Kv9BXWtXJOkswhaYJNrzO8MFJjZEwStyh0H4zaFr5mu85L+nxs+XkVwkAtgGMGdf+radvJ+Gwx8YGmOqy7pAO1+MLEvwTcjaOD+I/gd2XE84HyC7rpky4BihfeGlNRC0mHhH7JuZjYL+DHBZ65dPV4f4J/s6lu+gGBfAfyjxvwd/gP0ltQqbCmflJR1f0lHhlnbh39kZgLf29GVJekQBaMavgycF/ax7w/U7F5Mdl743C8TdN9sCOffQ/DN5rHwm1RNI4GhZlZiwciQA0jRj25m0wi6Smr9fTWzLQT7umZL/lXgWO06xtM2/N2E9D/ve/sziETeH0GvxQ3AY5I+Ivga2b2+GzKzGZKS+wX/DNwRfsWPA6PMbLuUqtcjLT8l+LpZEf6fzofvqvBrfluCYUZPTNF32YXgzik7/qhfE/7/AHCnpK2k14XSUdIighbujpbV3cDfJL0BPMOu1uYiIBHOfwBYkLSdG4D7wm1tYe/+0LYAfqfgdMttBPtqR591ffZfsk8IbnRxHUF3z3nJC82sUsEB4NsU3GKskOBYwtvAw+E8AbdZ/W83dhnBz+qH4fvYMULfFcAjkn4M/C0p02pJUwl+9u8S7ucw63nA7QoO9G8l6Nu+h6Bl/LqCD2oFu7otTiQY4vW/7PqDncq2sOuoBUH3yg7TCLpaUnW3lBB0few8XdHM3lVwKudRKV5jXPh+7w67xj4l1XEeM6tQcFB4sqRW4ezrCH5GE4BnJL2X1I+eyl79DKLioy06tweSNptZfVvWzZ6C88BvMbNBda7sGqy5ttCdc41M0ljge2RBV0Rz4S1055zLE831oKhzzuUdL+jOOZcnvKA751ye8ILunHN5wgu6c87lif8PY4pvI4Gw7FAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "N = 1000000\n",
    "k, X = sample_half_normal(N)\n",
    "1000000/k\n",
    "x = np.linspace(0,6,10000)\n",
    "plt.hist(X, bins=50, normed=True, label=r\"Stat\");\n",
    "plt.plot(x,np.sqrt(2/np.pi)*np.exp(-x**2/2), label=r\"PDF\")\n",
    "plt.legend()\n",
    "plt.xlabel(r\"Half Normal Distribution Samples Produced by AR Method\")\n",
    "plt.savefig('half_normal.pdf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "结果匹配一致。然后下面将其改造为标准正态分布。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(k):\n",
    "    w = np.random.rand()\n",
    "    if w > 0.5:\n",
    "        X[i] = -X[i]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f05f0090280>]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAoUUlEQVR4nO3deXxc5X3v8c9v5A0wBoOVgOVFtjGL8Y4wEEJYQ0xIcVLIKyZLSUovIUCaZrmtISm5l7QNIb1JaEIaSCC3CRDXgTY4sRNjwBCM8SLLtox3Sd4kGyy8r5Jmzq9/zJEZy7I1kkY6s3zfr5deM3O2+Q5YP515nuc8x9wdERHJX7GoA4iISNdSoRcRyXMq9CIieU6FXkQkz6nQi4jkuR5RB2hpwIABXlpaGnUMEZGcsnTp0nfdvbi1dVlX6EtLSykvL486hohITjGzzSdap6YbEZE8p0IvIpLnVOhFRPKcCr2ISJ5ToRcRyXNpFXozm2xm68ysysymnWS7W83MzawsZdn94X7rzOwjmQgtIiLpa3N4pZkVAY8BHwZqgSVmNtPdV7fY7nTgK8CilGW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d/uxsjpu1k/18AzOzzwMeA67P1D+8J5NVUHmbWk2SRf8bd/yvqPJ1wJXCLmX0U6AP0M7On3f2zEefqiFqg1t2bv109R7LQZ0Q+Nt38DrgWwMzOB3qRgzPbuftKd3+fu5e6eynJfwgTs7XItyW8ec3fA7e4+6Go87RTOtOA5IRw+vAngTXu/oOo83SGu9/v7oPC34+pJKdeycUiT/h7vdXMLggXXc+xU8F3Sk6e0bfhKeApM3sLaATuyLGzx3z1E6A3MDf8hrLQ3e+ONlJ6TjQNSMSxOupK4HPASjNbHi57wN1nRxdJQl8GnglPJmqAL2TqwJoCQUQkz+Vj042IiKRQoRcRyXMq9CIieU6FXkQkz6nQi4jkORV6EZE8p0IvIpLn/gfjvtg1el96pAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(-6,6,10000)\n",
    "plt.hist(X, bins=50, normed=True, label=\"Stat. of the Sampling\");\n",
    "plt.plot(x,1/np.sqrt(2*np.pi)*np.exp(-x**2/2))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "为防止重复抽取，应该直接在AR抽取中直接产生标准正态分布更好。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sample_normal(N):\n",
    "# N, 实际采样数\n",
    "    U = np.random.rand(N)  # 产生均匀分布\n",
    "    X = -np.log(U)  # 产生服从h的随机变量X\n",
    "    G = np.exp(-(X-1)**2/2)   # 计算g(X)\n",
    "    U = np.random.rand(N)  # 再次产生均匀分布\n",
    "    res = X[U<G]\n",
    "    for i in range(len(res)):\n",
    "        w = np.random.rand()\n",
    "        if w > 0.5:\n",
    "            res[i] = -res[i]\n",
    "    return len(res), res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png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+D1gfiseohvuB36XiByPO2xd1MTteva3uDXv4jrL+uP+ivgTbs1rhLeoxtsuGifKV2NYfhe3RgVus8YZ3vS3I9bfg9s8chhV3QXsiGh/vxGYV3e9hnjt67296QDuSejPaOXz5xkpbg+VAdxa6YI6y98HrhGR47zHP1ZE+ot7jiKgqm8CP+er57e5VgNZInKSNx9+bj71ygd65TdEbLMh/HgiMgK3a2twE+61ItIzHKtX/i5u51l45bne5Ie4rysicinQo4EYA8A13vSh94H3xTEL+CP1VIZEpBswCjhRv+qR9fY6x4JXW/4FcLaIDGogBnA/a7/F/eUVaRbwQ+9XCiLSx3u96n0/1qMlr0Hcs0TfPI/jttWG3Yn7c7UY9w3R4oGW1R1FainuG2oS8FHjWxzymvf4K4DO1D/E3Wjcfu2X4iawp7zyiUCxiEQzCMhq3PFFS3CTwB+98l8BT3knEw9rqgKu9k5+1T2pehPwmBd3Lm47fbSOA/4l7uWexbg12mda8fxFysftZbMEWI9bYzxEVVfhJvJ3vdhn454c7gPM9ZpDXqWF4+F6yfIW4A0RWY77a+N5r3wcMN1rmoocHvNN4FgRWQncgdsuj7q9az4MzBORZUC4S+K7gDzvROUq3F8g4L6OF3j7+RYNj1G8D/cLcQVubTzytXvNi/ndera7Grcb4cha9FvAv4VPdkY8DwdwP2v/3UAMqOv34aapiPJ3cV//T7zncCruOaltwEfinqxu8IqeFr4Gcc96rzQG96ob3JOaV/gcSsIS9+qf7qoak1GRTOwkbZuUMab9iMg/gIG4tXwTZ6xGb4wxSc7a6I0xJslZojfGmCRnid4YY5KcJXpjjElyluiNMSbJ/X9kSH9xyekRkwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "N = 1000000\n",
    "k, X = sample_normal(N)\n",
    "N/k\n",
    "x = np.linspace(-6,6,10000)\n",
    "plt.hist(X, bins=50, normed=True, label=\"Stat\");\n",
    "plt.plot(x,1/np.sqrt(2*np.pi)*np.exp(-x**2/2), label=r\"PDF\")\n",
    "plt.legend()\n",
    "plt.xlabel(r\"Normal Distribution Samples Produced by AR Method\")\n",
    "plt.savefig('normal.pdf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "注意这个统计图本身是不对称的，因为有概率涨落。但是进一步加细可以看到，其“极限”和目标PDF匹配的很好。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f05ef8fe610>]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAnyklEQVR4nO3de3xU9Z3/8ddnEgHloijxQkAIGFQQFIl4a7t1vRRbK724W3S7q277c22l7W+tv11srXb1t1u1++v2ov4q3ra2Ukq1rWlFERUviEAukEBAIAmXJNwCAcIlJJk5n/1jTnSMCZkkM/OdOfN5Ph55ZObMOWfeo+Sdk3P5HlFVjDHGBFfIdQBjjDHJZUVvjDEBZ0VvjDEBZ0VvjDEBZ0VvjDEBl+s6QGcjRozQsWPHuo5hjDEZpaysbI+q5nX1WtoV/dixYyktLXUdwxhjMoqIbO3uNdt1Y4wxAWdFb4wxAWdFb4wxAWdFb4wxAWdFb4wxARdX0YvIDBHZICLVIjLnGPN9WURURIpipt3tL7dBRD6TiNDGGGPi1+PplSKSAzwKXA3UAyUiUqyq6zrNNxT4DrAiZtpEYBYwCRgJvCYiE1Q1kriPYIwx5lji2aKfDlSraq2qtgHzgZldzPcA8BBwNGbaTGC+qraq6mag2l+fMZnH86JfxmSYeIo+H6iLeV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b0xxgScFb0xxgScFb0xxgScFb0xxgTc/wDi1F0hVhVruwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.hist(X, bins=100, normed=True, label=\"Stat\");\n",
    "plt.plot(x,1/np.sqrt(2*np.pi)*np.exp(-x**2/2), label=r\"PDF\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "现在回到半正态分布的例子。我们可以画出接受和拒绝区域。而常数$c$就是接受区域的面积（总面积是１）。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARcAAAENCAYAAAAlniEpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAtJklEQVR4nO3deXwU9f3H8dcnF5AQEsjJERLu+5IYBOTwBkTQVhSsRS2K4I9C1Vq1tdbqo6dtRQv1oEVU6oEXAoKgFuSQIEeUcJgQICEJIRfkJCHX9/dHQgwhQEh2Zze7n+fjsY9HdmZ257ObyTsz3+/Md8QYg1JK2ZqHowtQSrkmDRellF1ouCil7ELDRSllFxouSim70HBRStmFJeEiIktFJEtE9l1gvojISyKSJCJ7ReQKK+pSStmPVXsuy4AJF5k/EehV85gNvGxBTUopO7IkXIwxm4GTF1lkKvCmqRYLBIpIRytqU0rZh5ejC6jRGUit8zytZlpG/QVFZDbVezf4+fkN79u3ryUFtjRVxlBYWkHRmQpOn6mktKKyUa/z9BDaeHvSxscTX29P/Fp54ekhdq5WObPdu3fnGGNCLvd1zhIujWaMeQ14DSA6Otrs2rXLwRU5D2MM2w/n8ub2FP6XkEV5RRXBrb0Y1rU9Q7oEEBXkR+f2bQj09a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5XgONMS4xHmhL2HNpSZcONKZWROR64DfAFGPMGYtqa8il6vUHBgKbRCSZ6mPtVQ5q1G3Md5sGrDLGlBtjjgKJVIeNIzSm3lnACgBjzHagNdUXNTqjRm3b53BUA9JlNDR5AUeAbvzQMDag3jL/x7kNuiucuNZhVDf09WoJ32295TfhuAbdxny3E4A3an4Opno3PsiJ610H3Fvzcz+q21zEgdtDFBdu0L2Zcxt0v7nk+znqg1zmh55E9X+hw8BvaqY9S/V/fqhO/PeBJOAboLsT1/oFkAl8W/NY5czfbb1lHRYujfxuherDuANAPDDdmb9bqnuIttUEz7fAjQ6s9R0gAyineg9wFjAHmFPnu11c81niG7Md6On/Sim7aAltLkqpFkjDRSllFxouSim70HBRStmFhotSyi40XJRSdqHhopSyCw0XpZRdaLgouxORHiJy8uwAQyLSSUSyRWS8YytT9qRn6CpLiMgDwMNUXwn+MRBvjPmlY6tS9qThoiwjIquovpDPAFcax14RruxMD4uUlZZQPYTDPzVYXJ/uuShLiEhbqq/+3QhMBAYZYy42rKJq4TRclCVE5D9AW2PMnSLyGhBojLnD0XUp+9HDImV3IjKV6oGc5tZMegS4QkR+4riqlL3pnotSyi50z0UpZRcaLkopu9BwUUrZhYaLUsouNFyUUnah4aKUsgsNF6WUXWi4KKXs4v8BLNpKqHio3noAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(0,1,10000)\n",
    "z = -np.log(x)\n",
    "u = np.exp(-(z - 1)**2 / 2)\n",
    "plt.plot(x,u,label=r'$g(-\\log(x))$')\n",
    "plt.xlim(0.0, 1.0)\n",
    "plt.ylim(0.0, 1.0)\n",
    "#plt.axis(\"equal\")\n",
    "axs = plt.gca()\n",
    "axs.set_aspect('equal', 'box')\n",
    "plt.text(0.65, 0.9, r'reject',fontsize=\"12\")\n",
    "plt.text(0.05, 0.9, r'reject',fontsize=\"12\")\n",
    "plt.text(0.5, 0.5, r'accept',fontsize=\"12\")\n",
    "plt.legend(fontsize=\"12\")\n",
    "plt.xlabel(r\"x\",fontsize=\"12\")\n",
    "plt.ylabel(r\"u\",fontsize=\"12\")\n",
    "plt.savefig('AR_region.pdf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果我们有办法快速产生指数分布，比如我们直接调用Python提供的指数分布生成函数，那么下面的版本有可能比原始版本代价更低。当然这里速度的变化主要是Python提供的指数分布生成程序实在太快了。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sample_half_normal_v2(N):\n",
    "# N, 实际采样数\n",
    "    k = 0  # 实际接受总数\n",
    "    X = stats.expon.rvs(size=N)  \n",
    "    G = stats.expon.rvs(size=N)  # 产生两个独立的beta(1)\n",
    "    res = X[(X-1)**2/2<=G]\n",
    "    return len(res), res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0.5, 0, 'Half Normal Distribution Samples Produced by AR Method')"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEGCAYAAAB1iW6ZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAsh0lEQVR4nO3deXhU5fn/8fcnCyCrCLFVQIMKKhZlCahVLCi1WCvYan+AS6W1pS64YDcsVtHWb21tq1VpFVfqAqK1iggCVlSsqAREECiISAW0EiiCyJLMzP374xxgCAkZkklOZnK/ritX5ixz5jNL7jzznHOeIzPDOedc5suJOoBzzrn08ILunHNZwgu6c85lCS/ozjmXJbygO+dclsiL6oHbtm1rhYWFUT28c85lpHnz5q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swm/ZkrqDBwGLKvB9lsAn4Rf7S+sauXyJJ1H0AKbUG5+WyDHzP5O0KrcuTPu8/AxUzU46fec8PYqgp1cAAMJrvxT1baTX7e+wHpLcVx1SYdqz52J3Qi+GUENXz+Cv5Gd+wMuIOiuS7YMKFB4bUhJ+ZKOC/+RdTCzWcAvCD5zzavx+ABvsLtv+UKC1wrgX+Xm7/QfoIukxmFL+YykrIdI6hVmbRH+k5kOXL6zK0tSZwWjGr4GDA772A8ByncvJhsc3vdUgu6bTeH8Bwi+2TwVfpMqbygwwMwKLRgZsicV9KOb2WSCrpJK/17NbCvBa12+Jf8mcIp27+NpFv5tQuqf9/19DyKR9XvQKzEGeErSRoKvkR2ruyEzmyopuV/wL8Bfw6/4MWCYme2QKur1SMmvCL5uloS/U/nwjQy/5jcjGGb09Ar6LtsRXDll5z/168PfjwD3StpGal0orSUtJGjh7mxZ3Q88J+ld4EV2tzYXAvFw/iPAO0nbGQM8FG5rK/v3jzYf+IOCwy23E7xWO/usq/P6JfuC4EIXNxB09wxOXmhmpQp2AN+l4BJjeQT7EpYDj4XzBNxl1b/c2FUE79XPwuexc4S+a4AnJP0CeC4p02pJkwje+w8JX+cw62DgbgU7+rcR9G0/QNAynq/gg1rC7m6L0wmGeP2I3f+wK7I97DrKJ+he2WkyQVdLRd0thQRdH7sOVzSzDxUcynliBY9xS/h87w+7xvZS0X4eMytRsFN4gqTG4ewbCN6jccCLkj5O6kevyH69B1Hx0Rad2wdJW8ysui3rBk/BceB3mFmfKld2NdZQW+jOuVomaRRwOfWgK6Kh8Ba6c85liYa6U9Q557KOF3TnnMsSXtCdcy5LeEF3zrks4QXdOeeyxP8HNhJ5Te0v7ewAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "N = 1000000\n",
    "k, X = sample_half_normal_v2(N)\n",
    "1000000/k\n",
    "x = np.linspace(0,6,10000)\n",
    "plt.hist(X[0:k], bins=50, normed=True, label=r\"Stat\");\n",
    "plt.plot(x,np.sqrt(2/np.pi)*np.exp(-x**2/2), label=r\"PDF\")\n",
    "plt.legend()\n",
    "plt.xlabel(r\"Half Normal Distribution Samples Produced by AR Method\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARcAAAENCAYAAAAlniEpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAA0BklEQVR4nO3dd3hUZdrH8e8zk0klIaG30KSEKkgWQRFUUCkKiIhgwQKiKK5t99VVF+v6+m5xXVcsuCKKBVmUphQVUQEFRVA6oYeEJCSk90nmef84EwghJJMwNef+XJdXkpkzZ+7E8MvTznOU1hohhHA3i68LEEI0TBIuQgiPkHARQniEhIsQwiMkXIQQHiHhIoTwCK+Ei1JqnlLqhFJq5zmeV0qpV5VSB5RS25VSF3mjLiGE53ir5TIfGFnD86OArs7/ZgBveKEmIYQHeSVctNbfA5k1HDIOeF8bNgHRSqnW3qhNCOEZQb4uwKktcKzS10nOx1KqHqiUmoHRuiEiImJAXFxcrSc/mH2QYGswsZGx7qk2ANjL7GTnn6CoLJ9SyihV4MpabKuGYK0IVjZCgyKIimhKsC3E4/UK//XLL79kaK2b1/V1/hIuLtNazwXmAsTHx+stW7bU+pqbPr+JpqFNeX3E654uz6cc5eUsWvsqq498wg5bMVGWZrQtb0JHeyjtbW1oFdmZdjEX0DQ6loiQRgQFBZNXmEN2bgqpOYmk5BwkveQ4yWRzNNhBmVIorelYaqd7cDdGXng7l/W/1tffpvAypdTR+rzOX8IlGajcrGjnfMwtgi3BlDpK3XU6v+MoL+c/K19gWepiEoOhcZCDoeVtGNJ+PNddNo3g4NA6nzM7L4N1Py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DlZ9sN6KaU2qiU2qSUGum16s7mSr3PALcqpZKAlcAD3imtXur6ux14y/8bCqXUrUA8MMzXtZyLUsoCvAzc4eNSXBWE0TW6HKNF+L1Sqo/WOtuXRdVgCjBfa/0PpdRgjHVevbXWDWJPzUBouQTSpQOu1IpSagTwJDBWa13ipdqqU1u9kRgXh36rlDqC0dde7qNBXVd+tknAcq21XWt9GEjACBtfcKXeacAiAK31j0AoxkWN/sil3+0z+GoAqQ4DTUHAIaATpwfGelU55n7OHNBd5Me19scY6OsaCD/bKsd/i+8GdF352Y4E3nN+3gyjGd/Uj+tdBdzh/LwHxpiL8uHvQ0fOPaA7hjMHdH+q9Xy++kbq+E2PxvgrdBB40vnYcxh/+cFI/P8CB4CfgM5+XOvXQBrwq/O/5f78s61yrM/CxcWfrcLoxu0GdgCT/flnizFDtNEZPL8CV/uw1o+BFMCO0QKcBtwL3FvpZzvH+b3scOX3QJb/CyE8IhDGXIQQAUjCRQjhERIuQgiPkHARQniEhIsQwiMkXIQQHiHhIoTwCAkXIYRHSLgIj1NKXaCUyqzYYEgp1UYpla6Uuty3lQlPkhW6wiuUUncDD2NcCb4E2KG1/oNvqxKeJOEivEYptRzjQj4N/E779opw4WHSLRLe9DbGFg7/lmBp+KTlIrxCKdUI4+rfdcAooI/WuqZtFUWAk3ARXqGUegdopLW+SSk1F4jWWk/ydV3Cc6RbJDxOKTUOYyOnmc6HHgEuUkrd4ruqhKdJy0UI4RHSchFCeISEixDCIyRchBAeIeEihPAICRchhEdIuAghPELCRQjhERIuQgiP+H8/U54sM6uAxAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.linspace(0,1,10000)\n",
    "z = -np.log(x)\n",
    "g = np.exp(-(z - 1)**2 / 2)\n",
    "gl = 1 - (z - 1)**2 / 2\n",
    "gu = 1 - (z - 1)**2 / 2 + (z - 1)**4 / 8\n",
    "plt.plot(x,u,label=r'$g$')\n",
    "plt.plot(x,gl,label=r'$g_L$')\n",
    "plt.plot(x,gu,label=r'$g_U$')\n",
    "plt.xlim(0.0, 1.0)\n",
    "plt.ylim(0.0, 1.0)\n",
    "axs = plt.gca()\n",
    "axs.set_aspect('equal', 'box')\n",
    "plt.legend(fontsize=\"12\")\n",
    "plt.xlabel(r\"x\",fontsize=\"12\")\n",
    "plt.ylabel(r\"u\",fontsize=\"12\")\n",
    "plt.savefig('squeeze.pdf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 正态分布抽取\n",
    "\n",
    "在本章最后，我们单独介绍一个特别重要的分布的抽样方法——正态分布。服从 $N(\\mu, \\sigma^2)$ 的正态分布相应的 PDF 为\n",
    "$$\n",
    "\\begin{equation}\n",
    "  f(z) = \\frac{1}{\\sqrt{2\\pi \\sigma^2}} e^{\\frac{-(z -\n",
    "      \\mu)^2}{2\\sigma^2}}, \\sigma^2 > 0, z \\in \\mathbb{R}.\n",
    "\\end{equation}\n",
    "$$\n",
    "关于正态分布的一些性质，大家应该是熟知的：\n",
    "+ 若 $U$ 服从正态分布 $N(0, 1) $，则 $Z = \\mu + \\sigma U$ 服从 $N(\\mu, \\sigma^2)$ 分布；\n",
    "+ 若 $Z_1, Z_2, \\cdots, Z_n$ 是分别服从 $N(\\mu_1, \\sigma_1^2), N(\\mu_2, \\sigma_2^2), \\cdots, N(\\mu_n, \\sigma_n^2)$ 的独立随机变量，则 $Z = Z_1 + Z_2 + \\cdots + Z_n$ 服从分布 $N(\\mu_1 + \\mu_2 + \\cdots + \\mu_n, \\sigma_1^2 + \\sigma_2^2 + \\cdots + \\sigma_n^2)$.\n",
    "根据以上的性质，我们知道我们只需要抽样生成 $N(0, 1)$ 就足够了。我们之前已经介绍了如何由 AR 法产生半正态分布，进而抽样改造成标准正态分布。下面我们再介绍两种简单的抽取方法。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "假设\n",
    "$$\n",
    "\\begin{equation}\n",
    "  Z_n = \\sqrt{12/n}(X_1 + X_2 + \\cdots + X_n),\n",
    "  \\label{eq::normal_naive}\n",
    "\\end{equation}\n",
    "$$\n",
    "其中 $X_i$ 是独立的服从 $U(-\\frac{1}{2}, \\frac{1}{2})$ 的随机变量，那么显然有对 $i = 1, 2, \\cdots, n$, $E[X_i] = 0$, 且\n",
    "$$\n",
    "D[X_i] = \\int_{-\\frac{1}{2}}^{\\frac{1}{2}}x^2 dx = \\frac{1}{12}.\n",
    "$$\n",
    "也即 $Z_n$ 的头两阶矩和 $N(0, 1)$ 一致。当 $n \\to \\infty$ 时，$Z_n \\sim N(0, 1)$. 如果我们取 $n = 12$，那么甚至连根号都不用计算了，但是这时我们发现 $Z_{12}$ 实际上分布在 $(-6, 6)$ 区间而不是 $\\mathbb{R}$. 这个方法只有在条件简陋的情况下可以用一下。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "第二个方法可以总结成一个定理，由Box and Muller在1958年提出：令随机变量 $U$ 和 $V$ 分别服从 $U(0, 1)$ 和 $E(1)$（表示参数为 1 的指数分布），那么\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    X = \\sqrt{2 V}\\cos 2\\pi U\n",
    "    \\label{eq::normal_box_muller_xi}\n",
    "  \\end{equation}\n",
    "$$\n",
    "  和\n",
    "$$\n",
    "  \\begin{equation}\n",
    "    Y = \\sqrt{2 V}\\sin 2\\pi U\n",
    "    \\label{eq::normal_box_muller_eta}\n",
    "  \\end{equation}\n",
    "$$\n",
    "是服从 $N(0, 1)$ 的独立随机变量。\n",
    "\n",
    "**证明：** 注意到\n",
    "$$\n",
    "  f_U = 1, f_V = e^{-v}.\n",
    "$$\n",
    "再令\n",
    "$$\n",
    "  x = \\sqrt{2v}\\cos 2\\pi u, y = \\sqrt{2v}\\sin 2\\pi u,\n",
    "$$\n",
    "则有  \n",
    "$$\n",
    "2 v = x^2 + y^2\n",
    "$$\n",
    "和\n",
    "$$\n",
    "  \\tan 2 \\pi u =\\frac{y}{x}.\n",
    "$$\n",
    "因此 $X$ 和 $Y$ 的联合分布函数为\n",
    "$$\n",
    "\\begin{equation}\n",
    "    f_{X, Y}(x, y) = f_{U, V}(u(x, y), v(x,\n",
    "    y))\\left|\\frac{\\partial u}{\\partial x}\\frac{\\partial v}{\\partial\n",
    "      y} - \\frac{\\partial u}{\\partial y}\\frac{\\partial v}{\\partial\n",
    "      x}\\right| = \\frac{1}{2 \\pi}e^{-\\frac{x^2 + y^2}{2}}.\n",
    "  \\end{equation}\n",
    "$$\n",
    "则 $f_X$ 和 $f_Y$ 各自的边界分为标准正态分布。证毕。\n",
    "\n",
    "而当前已知生成正态分布最快的方法是由 Marsaglia 在 1964 年提出的rectangle-wedge-tail方法，并在 1972 年由 Ahrens 和 Dieter 修改成 RT 算法。但是他们的方法都需要准备大量的预制表格，这一系方法实现比较繁琐。在不用查表的情况下，生成正态分布最快的方法，它是由 Ahrens 和Dieter 在 1988 年提出的 NA 算法。有兴趣的同学可自行参阅 Fishman1995。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
